#pragma once
#include <iostream>
#include <string>
#include <cstdarg>
#include <ctime>

enum
{
    Debug = 0,
    Info,
    Warning,
    Error,
    Fatal
};

std::string LevelToString(int level)
{
    switch (level)
    {
    case Debug:
        return "Debug";
    case Info:
        return "Info";
    case Warning:
        return "Warning";
    case Error:
        return "Error";
    case Fatal:
        return "Fatal";
    default:
        return "Unknown";
    }
}

class Log
{
public:
    Log() {}
    void LogMessage(int level, const char *format, ...)
    {
        char buffer[1024];
        va_list args;
        va_start(args, format);
        vsnprintf(buffer, sizeof buffer - 1, format, args);
        va_end(args);
        printf("[%s][%s]%s", LevelToString(level).c_str(), std::to_string(time(nullptr)).c_str(), buffer);
    }
    ~Log() {}
};